import type { BrowserWindow } from "electron";

const winds = new Map<number, BrowserWindow>();

export function registerWindowHolder(wind: BrowserWindow) {
  winds.set(wind.webContents.id, wind);
  wind.once("close", () => winds.delete(wind.webContents.id));
}

export function getWindow(webContentsId: number) {
  return winds.get(webContentsId);
}
